<template>
    <div class="page-friend">
        <div class="topbar">
            <span class="back" @click="onBack">返回</span>
            <span class="submit" @click="onSubmit">发送</span>
        </div>
        <div class="text">
            <textarea placeholder="请输入申请内容" v-model="value"></textarea>
        </div>
    </div>
</template>

<script>
export default {
    name: '',
    data() {
        return {
            value: ''
        }
    },
    methods: {
        onBack() {
            this.$router.back(-1)
        },
        onSubmit() {
            if(this.value.length) {
                var obj = {
                    type: 'add',
                    fromId: this.$store.state.userInfo.id,
                    toId: this.$route.params.id,
                    token: this.$store.state.userInfo.token,
                    value: this.value
                }
                var data = JSON.stringify(obj);
                this.ws.send(data);
            }
        }
    }
}
</script>

<style lang="scss" scoped>
@import '../assets/scss/theme.scss';
.page-friend{
    width:100vw;
    height:100vh;
    @include background_color('background_color7');
    .topbar{
        display: flex;
        padding:10px;
        font-size:14px;
        justify-content: space-between;
        @include background_color('background_color4');
        @include font_color('font_color7');
    }
    .text{
        width:100%;
        padding:10px;
        textarea{
            width:100%;
            height:30vh;
            border-radius:10px;
            padding:10px;
            font-size:14px;
            outline:none;
            resize:none;
            @include font_color('font_color1');
            @include border_color('border_color2');
            @include background_color('background_color8');
        }
    }
}
</style>